﻿#region << 文 件 说 明 >>
/*----------------------------------------------------------------
// 文件名称：ModelEdit
// 创 建 者：杨程
// 创建时间：2021/9/22 10:58:49
// 文件版本：V1.0.0
// ===============================================================
// 功能描述：
//		
//
//----------------------------------------------------------------*/
#endregion

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vampirewal.Core.Attributes;
using Vampirewal.Core.Models;

namespace V.CodeGenerator.Model
{

    public class ModelEdit:BillBaseModel
    {
        /// <summary>
        /// 字段名称
        /// </summary>
        public string PropName { get; set; }

        /// <summary>
        /// 字段描述
        /// </summary>
        public string PropDes { get; set; }

        /// <summary>
        /// 字段类型
        /// </summary>
        public PropType propType { get; set; }

        /// <summary>
        /// 字段长度
        /// </summary>
        public int PropLength { get; set; }

        /// <summary>
        /// 最小值
        /// </summary>
        public int MinValue { get; set; }

        /// <summary>
        /// 最大值
        /// </summary>
        
        public int MaxValue { get; set; }

        /// <summary>
        /// 字段精度
        /// </summary>
        public int PropPrecision { get; set; }

        /// <summary>
        /// 是否必填
        /// </summary>
        public bool IsRequired { get; set; }

        /// <summary>
        /// 是否生成数据库字段
        /// </summary>
        public bool IsCreateDbProp { get; set; }

        /// <summary>
        /// 范围限制
        /// </summary>
        public string ScopeOfMinAndMax
        {
            get
            {
                return $"{MinValue}-{MaxValue}";
            }
        }

        /// <summary>
        /// 关联的ProjectModelDtl
        /// </summary>
        public string ProjectModelDtlId { get; set; }
    }

    public enum PropType
    {
        [SetClassification(Type = 1)]
        [Display(Name ="字符串(String)")]
        @string=0,
        [SetClassification(Type = 2)]
        [Display(Name ="日期时间(datatime)")]
        datetime=1,
        [SetClassification(Type = 3)]
        [Display(Name = "布尔(bool)")]
        @bool =2,
        [SetClassification(Type = 4)]
        [Display(Name = "一对多关联")]
        OneToMany =3,
        [SetClassification(Type = 5)]
        [Display(Name = "子表")]
        ChildTable =4,
        [SetClassification(Type = 6)]
        [Display(Name = "短整数(Short)")]
        @short =5,
        [SetClassification(Type = 7)]
        [Display(Name = "整数(Int)")]
        @int =6,
        [SetClassification(Type = 8)]
        [Display(Name = "长整数(long)")]
        @long =7,
        [SetClassification(Type = 9)]
        [Display(Name = "单精浮点(float)")]
        @float =8,
        [SetClassification(Type = 10)]
        [Display(Name = "双精浮点(double)")]
        @double =9,
        [SetClassification(Type = 11)]
        [Display(Name = "小数(decimal)")]
        @decimal =10,

    }
}
